package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	router := gin.Default()

	// Simple group: v1
	goodsGroup := router.Group("/goods")
	{
		goodsGroup.GET("", goodsList)
		goodsGroup.GET("/:id/:action", goodsDetail)
		goodsGroup.GET("/file/*filepath", goodsFile)
		goodsGroup.POST("/add", addGoods)
	}
	router.Run(":8080")
}

func goodsFile(c *gin.Context) {
	filePath := c.Param("filepath")
	c.JSON(http.StatusOK, gin.H{
		"filepath": filePath,
	})
}

func addGoods(c *gin.Context) {

}

func goodsDetail(c *gin.Context) {
	id := c.Param("id")
	action := c.Param("action")
	c.JSON(http.StatusOK, gin.H{
		"id": id,
		"action": action,
	})
}

func goodsList(c *gin.Context) {

}
